<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<link rel="stylesheet" href="${s.base}/mobile/base/css/base.css">
		<link rel="stylesheet" href="${s.base}/mobile/base/css/weui.min.css">
		<link rel="stylesheet" href="${s.base}/mobile/base/css/jquery-weui.css">
		<link rel="stylesheet" type="text/css" href="${s.base}/mobile/shaping/css/index.css"/>
		<style type="text/css">
			body,html{background: #fff;}
		</style>
	</head>
	<body>
		<p class="title_title">服务项目</p>
		<div id="classify">
		</div>
		<div class="cut"></div>
		<div style="display: flex;align-items: center;margin-left: 20px;margin-bottom: 20px;">
			<span style="width:6px;height:31px;background:rgba(251,189,37,1);display: inline-block;margin-right: 20px;"></span>
			<p style="font-size:28px;color:rgba(0,0,0,1);margin-top: -1px;">热卖商品</p>
		</div>
		<div id="store_list">
		</div>
	</body>
</html>
<script src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
<script src="${s.base}/mobile/base/js/jquery-2.1.4.js" type="text/javascript" charset="utf-8"></script>
<script src="${s.base}/mobile/base/js/jquery-weui.js" type="text/javascript" charset="utf-8"></script>
<script src="${s.base}/mobile/base/js/swiper.js" type="text/javascript" charset="utf-8"></script>
<script src="${s.base}/mobile/shaping/js/window_port.js" type="text/javascript" charset="utf-8"></script>
<script src="${s.base}/mobile/base/js/component.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
    var userId='${webConfig.userId}';
    var colId='20190609092823077471018528694766';
    var pageNum=0;
    var loading = false;  //状态标记
    var pageSize=5;
    $(document).ready(function(e) {
        initDate();
    });
    function initDate() {
        acceptXygArticleListByColId('20190608162249067818730954662081','${webConfig.userId}',10,function (data) {
            data.forEach(function (item,key,mapObj) {
                if(key==0){
                    $("#classify").html('<div><img src="'+item.thumImage+'" alt=""><p>'+item.title+'</p></div>');
                }else{
                    $("#classify").append('<div><img src="'+item.thumImage+'" alt=""><p>'+item.title+'</p></div>');
                }
            });
        });
        sendPost();
        initInfinite();
    }
    function  initInfinite() {
        $(document.body).infinite();
        $(document.body).infinite().on("infinite", function() {
            if(loading) return;
            loading = true;
            sendPost();
        });
    }
    function sendPost() {
        pageNum++;
        acceptXygProduct(colId,userId,pageNum,pageSize,function (result) {
            if (result.code == 0){
                if (result.data!=null && result.data.length > 0){
                    for(var i=0;i<result.data.length;i++){
                        var obj = result.data[i];
                        var content='<div class="store_block"><img src="'+obj.coverImage+'" alt="">'+
                            '<p class="store_title font-grade-two" onclick="jumpProductPage(\''+obj.id+'\',\'${webConfig.id}\',\'productDesc\')">'+obj.name+'</p><div class="store_cion"><p>￥'+obj.origPrice+'</p>' +
							'<img src="${s.base}/mobile/shaping/img/25.png" alt=""></div>' +
							'<p class="cut_store_cion">￥'+obj.persentPrice+'</p></div>';
                        $("#store_list").append(content);
                        loading = false;
                        if(!result.hasNextPage){
                            $(document.body).destroyInfinite();
                        }
                    }
                }
            }
        });

    }

</script>
